import type { AppRouteModule } from '@/router/types'

// 多级菜单，父路由要配置redirect到最末级子路由，不然多级面包屑下拉菜单项点击会找不到路由
const level: AppRouteModule = {
  path: '/level',
  name: 'Level',
  meta: {
    type: 'menu',
    title: '多级菜单',
    icon: 'folder-add'
  },
  component: () => import(/* webpackChunkName: "empty" */ '@/layout/cnps/empty/empty.vue'),
  children: [
    {
      path: 'menu1',
      name: 'Menu1',
      redirect: '/level/menu1/menu1-1/menu1-1-1',
      meta: {
        title: 'Menu1',
        icon: 'folder'
      },
      component: () => import(/* webpackChunkName: "empty" */ '@/layout/cnps/empty/empty.vue'),
      children: [
        {
          path: 'menu1-1',
          name: 'Menu11Demo',
          redirect: '/level/menu1/menu1-1/menu1-1-1',
          meta: {
            title: 'Menu1-1'
          },
          component: () => import(/* webpackChunkName: "empty" */ '@/layout/cnps/empty/empty.vue'),
          children: [
            {
              path: 'menu1-1-1',
              name: 'Menu111Demo',
              meta: {
                title: 'Menu1-1-1'
              },
              component: () =>
                import(/* webpackChunkName: "menu111" */ '@/views/pages/level/Menu111.vue')
            }
          ]
        },
        {
          path: 'menu1-2',
          name: 'Menu12Demo',
          meta: {
            title: 'Menu1-2'
          },
          component: () =>
            import(/* webpackChunkName: "Menu12Demo" */ '@/views/pages/level/Menu12.vue')
        }
      ]
    },
    {
      path: 'menu2',
      name: 'Menu2Demo',
      meta: {
        title: 'Menu2',
        icon: 'folder'
      },
      component: () => import(/* webpackChunkName: "menu2" */ '@/views/pages/level/Menu2.vue')
    }
  ]
}

export default level
